#!/usr/bin/perl

my @pids = (5,3,9,2,18);
foreach my $pid (@pids)
{
	print $pid, ' ';
}

print "\n";

my @sortedPids = sort { $a <=> $b } @pids;
print "@sortedPids\n";

my @desc_sortedPids = sort { $b <=> $a } @pids;
print "@desc_sortedPids\n";
